import request from '@/utils/request';


export async function getHome() {
  return request('/api/getHome')
}


export async function login(params) {
    return request('/api/login', {
        method: 'POST',
        data: params,
    })
}

// 获得用户信息
export async function getUserInfo(params) {
    return request(`/api/user/${params}`)
}



export async function editEnv(params) {
  return request(`/api/ent/query=entid:${params.Id}`, {
      method: 'PUT',
      data: params,
  })
}

export async function addEntOps(params) {
  return request('/api/ent_ops', {
      method: 'POST',
      data: params,
  })
}

export async function putEntOps(params) {
  return request(`/api/ent_ops/query=entid:${params.Id}`, {
      method: 'PUT',
      data: params,
  })
}

// get企业概况
export async function qiyegaikuang(id) {
  return request(`/api/ent_ops?query=entid:${id}`)
}




// post企业概况
export async function postQiyegaikuang(params) {
  return request('/api/ent_ops', {
    method: 'POST',
    data: params,
})
}



// 获取街道信息
export async function getStreet() {
  return request('/api/street')
}

// 企业基本信息详情
// 操作
export async function basicFormOperation(text) {
  return request(`/api/ent?${text}`)
}

// 基本信息表get post put
export async function getBasicForm(params) {
  if (params.id) {
    return request(`/api/ent?query=id:${params.id}`)
  }
  return request('/api/ent')
}

export async function postBasicForm(params) {
  return request('/api/ent', {
    method: 'POST',
    data: params,
  })
}

export async function putBasicForm(params) {
  return request(`/api/ent/query=entid:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}


// 经营表get post put
export async function getBusinessForm(id) {
  return request(`/api/ent_ops?query=entid:${id}`)
}

export async function postBusinessForm(params) {
  return request('/api/ent_ops', {
    method: 'POST',
    data: params,
  })
}

export async function putBusinessForm(params) {
  return request(`/api/ent_ops/query=id:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}


// 奖励表rewards get post put
export async function getRewardsForm(id) {
  return request(`/api/ent_rewards?query=entid:${id}`)
}

export async function postRewardsForm(params) {
  return request('/api/ent_rewards', {
    method: 'POST',
    data: params,
  })
}
export async function putRewardsForm(params) {
  return request(`/api/ent_rewards/query=id:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}

// 荣誉表honor
export async function getHonorForm(id) {
  return request(`/api/ent_honor?query=entid:${id}`)
}

export async function postHonorForm(params) {
  return request('/api/ent_honor', {
    method: 'POST',
    data: params,
  })
}
export async function putHonorForm(params) {
  return request(`/api/ent_honor/query=id:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}

// 技术表tec
export async function getTecForm(id) {
  return request(`/api/ent_tec?query=entid:${id}`)
}

export async function postTecForm(params) {
  return request('/api/ent_tec', {
    method: 'POST',
    data: params,
  })
}
export async function putTecForm(params) {
  return request(`/api/ent_tec/query=id:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}

// 产品表
export async function getProductForm(id) {
  return request(`/api/product?query=entid:${id}`)
}

export async function postProductForm(params) {
  return request('/api/product', {
    method: 'POST',
    data: params,
  })
}
export async function putProductForm(params) {
  return request(`/api/product/query=id:${params.id}`, {
    method: 'PUT',
    data: params.data,
  })
}